//一个适用于vue3获取图片的函数
export const getAssetsImage = (pngName: any) => {
  return new URL(`../assets/imgs/${pngName}.png`, import.meta.url).href
}

//随机id
export const generateRandomId = () => {
  const timestamp = new Date().getTime() // 获取当前时间戳
  const randomNum = Math.floor(Math.random() * 10000) // 生成一个0-999之间的随机数
  return `${timestamp}_${randomNum}` // 返回拼接后的ID字符串
}

//保留一位小数向上取整
export const numCeilToFixed1 = (num: any) => {
  const rounded = Math.ceil(num * 10) / 10
  return rounded.toFixed(1)
}
